package com.cino.demos.sourceCode.AOPdemo;

import java.lang.reflect.Proxy;
import java.util.List;

public class AopProxyFactory {
    @SuppressWarnings("unchecked")
    public static <T> T createAopProxy(Class<T> interfaceClass, T target, 
                                     List<MethodInterceptor> interceptors) {
        return (T) Proxy.newProxyInstance(
            interfaceClass.getClassLoader(),
            new Class[]{interfaceClass},
            new AopInvocationHandler(target, interceptors)
        );
    }
}